package cn.nfwx.tv.db;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import java.util.List;

@Dao
public interface AppointDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(TvAppointment... tvAppointments);

    @Update
    void update(TvAppointment... tvAppointments);

    @Delete
    void delete(TvAppointment... tvAppointments);

    @Query("SELECT * FROM tb_tvappoint")
    List<TvAppointment> queryForAll();

    @Query("select * from tb_tvappoint where program_id = :programId")
    List<TvAppointment> queryAllById(int programId);

    @Query("SELECT * FROM tb_tvappoint WHERE program_id IN (:ids)")
    List<TvAppointment> queryAllById(List<Integer> ids);
}
